using System.IO;
using System.Net.Sockets;
using OracleInternal.Common;

namespace OracleInternal.NotificationServices
{
	internal class ONSTcpClient
	{
		protected Stream sockStream;

		private Socket sock;

		internal ONSTcpClient(Socket sock, Stream sockStream)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2097408, OracleTraceClassName.ONSTcpClient, OracleTraceFuncName.ctor);
			}
			this.sock = sock;
			this.sockStream = sockStream;
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2097664, OracleTraceClassName.ONSTcpClient, OracleTraceFuncName.ctor);
			}
		}

		internal Stream GetStream()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2097408, OracleTraceClassName.ONSTcpClient, OracleTraceFuncName.GetStream);
			}
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2097664, OracleTraceClassName.ONSTcpClient, OracleTraceFuncName.GetStream);
			}
			return sockStream;
		}

		internal void Close()
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2097408, OracleTraceClassName.ONSTcpClient, OracleTraceFuncName.Close);
			}
			sock.Close();
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)2097664, OracleTraceClassName.ONSTcpClient, OracleTraceFuncName.Close);
			}
		}
	}
}
